.\"   $Id: loadphfig.3,v 1.1 2002/03/08 13:51:02 fred Exp $
.\" @(#)loadphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
loadphfig
.XE
.XS1 \n%
.ti 0.2i
loadphfig
.XE1 \}
.TH LOADPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS"
.SH NAME
loadphfig \- load a new physical cell model from disk 
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mph.h"
void loadphfig(ptfig, figname, mode)
phfig_list \(**ptfig;
char \(**figname;
char mode;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIptfig\fP
Pointer to an allocated but empty \fIphfig\fP
.TP
\fIfigname\fP
Name of the figure to be loaded
.TP
\fImode\fP
Loading mode
.SH DESCRIPTION
\fBloadphfig\fP fills the \fIphfig\fP pointed to by \fIptfig\fP with the 
contents of a disk file called \fIfigname\fP. The loading mode may be either
\fB'A'\fP, then the entire content is parsed, or \fB'P'\fP then only
connectors, abutment box, and through routes are loaded, or \fB'C'\fP, that
finishes to fill an already loaded figure in \fB'P'\fP mode, in order to have
it all in memory. This last mode allows to keep the same \fIptfig\fP pointer
when reaccessing the same file.
.br
The \fBloadphfig\fP function in fact performs a call to a parser, chosen
by the \fBMBK_IN_PH\fP(1) environment variable. The directories searched for the
file are first the one set by \fBMBK_WORK_LIB\fP(1) and then, in the described
order, the ones set by \fBMBK_CATA_LIB\fP(1).
See \fBMBK_IN_PH\fP(1), \fBMBK_WORK_LIB\fP(1), \fBMBK_CATA_LIB\fP(1) and
\fBmbkenv\fP(3) for details.
.SH ERRORS
Some errors resulting from a call to \fBloadphfig\fP are due to the parsers,
and are prefixed by the parser format (pf). 
.br
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** not supported physical input format 'xxx'"
.ft R
.RS
The environment variable \fIMBK_IN_PH\fP is not set to a legal physical
format.
.RE
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** pfloadphfig : could not open file \fIfigname\fP"
.ft R
.RS
No file called \fIfigname.ext\fP, where \fIext\fP is the file format extension,
has been found in the directories set by the environment.
.RE
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** pfloadphfig : syntax error line x parsing \fIfigname.ext\fP"
.ft R
.RS
Either the file has been corrupted and its syntax is not legal, or there is a
bug in the given parser.
.RE
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mph.h"
phfig_list \(**get_the_phfig(figname, mode)
char \(**figname;
char mode;
{
phfig_list \(**pt;
	for (pt = HEAD_PHFIG; pt; pt = pt\->NEXT) /\(** scan figure list \(**/
		if (!strcmp(pt\->NAME, figname))
			break;
	if (!pt) { /\(** figure doesn't exist \(**/
		pt = addphfig(figname);
		pt\->MODE = mode == 'A' ? mode : 'P';
		loadphfig(pt, figname, pt\->MODE);
		return pt;
	}
	if (ptfig\->MODE != 'A') { /\(** figure exists interface only \(**/
		if (mode == 'A') {
			pt\->MODE = 'A';
			loadphfig(pt, figname, 'C');
			return pt;
		} else
			return pt;
	} else /\(** figure exists interface and body \(**/
		return pt;
}
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR mbkenv (3),
.BR phfig (3),
.BR addphfig (3),
.BR getphfig (3),
.BR delphfig (3),
.BR savephfig (3),
.BR flattenphfig (3),
.BR rflattenphfig (3),
.BR MBK_IN_PH (1),
.BR MBK_WORK_LIB (1),
.BR MBK_CATA_LIB (1).


.so man1/alc_bug_report.1

